# for...in
# eg1
sum = 0
for i in [1,2,3,4,5,6]:
    Sum = sum + i
print(sum)   
# eg2 计算1+2-3+4-...966
sum = 0
for i in range(1, 967):
    if i % 2 != 0:
        sum = sum + i
    else:
    sum = sum - i
print(sum)  

# while:条件表达式＋循环体＋改变变量
sum = 0
n = 99
while  n > 0:
    sum = sum + n
    n = n - 2
print(sum)  

#continue与breack的使用：前者结束本次循环进入下一循环；后者结束整个循环过程
n = 1
while n <= 100:
    if n >10:
        break
    print(n)
    n = n + 1
print(" ",end ="\n")

    